/*
* Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description: ViewManager.qml.
*/

import QtQuick 1.0
import "ViewManager.js" as SVM

/*!
 *  \file
 *  \brief Defines simple view manager element.
 *
 *  The views are children of the component.
 */

Rectangle {
    id: myViewManager
    anchors.fill: parent

    default property alias content: viewContainer.children

    Component.onCompleted: {
        var views = viewContainer.children;
        if (views.length > 0) {
            SVM.currentView = views[0];
            var view

            for (var i = 0; i < views.length; i++) {
                view = views[i];
                view.visible = (i == 0);
                SVM.connectViewEvents(view)
            }
        }
    }

    Rectangle {
        id: viewContainer
        anchors.fill: parent
    }
}
